﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<WebPortal.Models.ViewModel.UserGoodsModel>>" %>

<asp:Content ID="CSS" ContentPlaceHolderID="StylesContainer" runat="server">
    <link href="../../Content/Admin.css" rel="stylesheet" type="text/css" />
</asp:Content>

<asp:Content ID="JS" ContentPlaceHolderID="ScriptContainer" runat="server">
    <script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../../Scripts/admin.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.md5.js"></script>
    <script type="text/javascript" src="../../Scripts/cookie.js"></script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	User editing page
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<% for (int i = 0; i < Model.Count; i++)
    { %>
    <div class="user-edit">
        <a class="edit edit-name"><%:Model[i].Email%></a> | <a class="show">Show orders</a> | <a class="edit">Edit rule</a>
        <div class="orders-list"></div>
        <form action="/Users/Edit" method="post">
            <input type="hidden" name="Id" value="<%:Model[i].UserID%>" />
            <input type="checkbox" name="IsAdmin" <% if (Model[i].IsAdmin) { %> checked="checked" <% } %> />
            <label for="IsAdmin">This user is administrator</label>
            <input type="submit" name="save" value="Save" />
        </form>
        <div class="orders-history">
            <ul>
            <% if (Model[i].Goods.Count > 0) { %>
                <% for (int j = 0; j < Model[i].Goods.Count; j++ ) { %>
                <li><%:Model[i].Goods[j].Name%> (<%:Model[i].Goods[j].BasketCount%>)</li>
                <% } %>
            <% } else { %>
                <li>No orders for this user</li>
            <% } %>
            </ul>
        </div>
    </div>
<% } %>
</asp:Content>
